home *** CD-ROM | disk | FTP | other *** search
- f2c-stabs - Fortran parsing and symbol table handling for
- f2c/gdb/emacs...
- Version 0.9 - ********** Alpha Version ************
-
- Copyright (c) 1996 Harvey J. Stein <abel@netvision.net.il>, and
- eventually <hjstein@netvision.net.il>
- All Rights Reserved.
-
- This package is covered by the GNU GPL. You can freely use and
- distribute it as long as it stays under the GNU GPL, and as long as
- you distribute all the corresponding source code, and as long as this
- message and the above copyright notice remains.
-
- Introduction
- ------------
- This is the f2c-stabs package. It includes the following:
-
- -A (very weak) Fortran parser called fts-f2si - extracts variable
- declarations, etc from fortran code.
-
- -Emacs elisp code defining a function f2c-gdb - converts a Fortran
- expression into the corresponding C expression that f2c would have
- created, and passes it to GDB for evaluation. For use when
- running gdb from within emacs on code compiled by f2c. Figures
- out symbol names, array referencing, etc.
-
- -A script make-f2c-stabs, which takes the output of fts-f2si and
- converts it into the format needed by f2c-gdb.
-
- -A script make-test-routines - Takes the output of fts-f2si and
- generates a "reader" subroutine, a "writer" subroutine, and a
- "driver" program. Doesn't work so well yet, and requires a
- Fortran i/o library which is such a hack that I'm not currently
- distributing it.
-
- This is considered an Alpha testing version because although I and my
- coworkers have been using it successfully, this is the first time it's
- been released to the Internet, so there are bound to be
-
- Bug Reports, enhancements, and comments
- ---------------------------------------
- Bug reports, enhancements and comments to abel@netvision.net.il
- (until hjstein@netvision.net.il exists).
-
- For bug reports, please include enough information to reproduce the
- bug - hardware setup, software versions, source code example, etc.
- Take a look at the emacs info page on reporting bugs for guidelines
- on writing useful bug reports. Please avoid reporting on bugs that
- are already noted (here or in the scripts), unless it's to say that
- you really desperately need it fixed, in which case it isn't a bug
- report - it's a comment.
-
- For enhancements, please include documentation on how to apply
- and/or use the enhancement.
-
- Requirements
- ------------
- For f2c-gdb:
- emacs 19
- gdb
-
- For fts-f2si:
- bash (sh will do, probably)
- gawk (I don't know if awk will work)
-
- For make-f2c-stabs and make-test-routines:
- STk (can be gotten by anonymous ftp from kaolin.unice.fr, or
- from sunsite.unc.edu)
- fts-f2si
-
- Installation
- ------------
- 1. Modify scripts if necessary. For example, you might need to
- change:
-
- #!/bin/bash
- #!/usr/bin/gawk -f
- #!/usr/local/bin/snow
-
- to whatever's appropriate on your system.
-
- 2. Modify the Makefile if necessary. Instructions are included in
- comments at the top of the makefile.
-
- 3. Do make. Make will compile the .el files and move everything to
- the appropriate directories (if you did step 2 correctly).
-
- 4. Add (require 'f2c-stabs) and (global-set-key "\C-c\C-v" 'f2c-gdb)
- to your .emacs file. The former is required, the latter is
- recommended.
-
-
- Usage
- -----
- 1. In your source code directory (which must be the current directory
- when debugging), run:
-
- fts-f2si *.f *.inc
- rm *.el
- make-f2c-stabs *.si
-
- This should make a .el file for each .f and .inc that you have in the
- current directory. NOTE - be careful not to accidentally remove any
- .el files that you really need. make-f2c-stabs *appends* symbol table
- to the corresponding .el files. You must remove the old .el files
- before making new ones, but you should make sure not to inadvertently
- remove something you need.
-
- 2. Add the following to your .emacs (if you haven't already):
-
- (require 'f2c-stabs)
- (global-set-key "\C-c\C-v" 'f2c-gdb)
-
-
- This will then enable the command C-cC-v when debugging f2c compiled
- code from within gud-mode. This command will prompt (with command
- history) for a Fortran expression, and will coerce gdb into printing
- its value. For example, when gdb is stopped in the subroutine
- mbs_oas_nt, C-cC-v ref_rate[cp_start, 2*(path+1)] will get expanded
- to ((mbsrtnarg_.ref_rate__[((cp_start__+((1+(360-((-
- 3)+1)))*(2*(path+1))))-(((- 3)+1)+(1+(360-((- 3)+1)))))])), which will
- be passed to gdb for evaluation.
-
- Iterators can be used, as long as the arguments are numbers. For
- example, C-cC-v ref_rate[cp_start+6*(0:10), path] would coerce gdb
- into printing out every 6th value of ref_rate.
-
- Arbitrary Fortran expressions may be used (such as
- (ref_rate[2,1]-ref_rate[3,1])/zeroytm[2]).
-
- The f2c-gdb command supports completion. Hitting a <tab> will
- complete the symbol before the cursor. Currently, although local
- variables which are scalars can be used in expressions, they are not
- loaded into the symbol table data, so completion will not find them.
- Note that completion won't work until something's been evaluated in
- the current context (to force loading of the symbol tables).
-
- Everything is autoloading - f2c-gdb will automatically load the .el
- files needed to interpret symbols in the current gdb context.
-
- If something doesn't load properly, use the command
- f2c-clear-stab-table to clear the symbol tables, and get emacs to
- start loading again from scratch. Also, use f2c-clear-stab-table
- after changing source code (and rebuilding corresponding .si and .el
- files), and when cahnging the executable that one's debugging.
-
- NOTE - Four things that aren't handled:
-
- 1. Array dimensions which include parameters - fts-f2si will parse
- them incorrectly.
- 2. Parameters which are logicals - f2c-gdb won't translate them
- into the corresponding C values for gdb.
- 3. Exponentiation. If exponentiation is used in array dimensions
- or in parameter definitions, f2c-gdb won't translate them
- properly. These you'll have to modify by hand.
- 4. Weirdo expressions (such as funky expressions in a & b which,
- because of Fortran's evaluation rules, evaluate to max(a,b)).
-
- See comments at the top of f2c-stabs.el for a long detailed
- explanation of how to use it.
-
- See other scripts and code for other uses, as well as other nifty
- functions included in this package.
-
- To Do
- -----
- Anyone who wants to take on any of these tasks, feel free. But, try
- to get in contact with me first, to avoid duplication of effort:
-
- -Better Fortran parsing - fts-f2si.awk is in need of work and/or
- replacement (can't handle parentheses within dimensions
- i.e. -real*8 foo(2*(p1+p2):3*(p1+p2))).
- -Port make-f2c-stabs to elisp. I should have written it in elisp
- to begin with. f2c-gdb should autoload the .si files instead of
- the corresponding .el files. This would alleviate the need for
- STk, something that most people won't have (even though they
- should :). At least, rename all the .stk code to .scm and make
- it generic enough to also work both with stk and scm. Please
- someone do this for me :)!
- -Better interface between f2c-gdb and gdb. Ideally, hitting
- carriage return would parse the current line, doing symbol
- replacements and array dereferencing before giving the line to
- gdb.
- -Clean up interface betwe4en f2c-gdb and gdb - Clearly delineate
- what's gud specific and what's gdb specific, and compartmentalize
- the gdb specific stuff so that people can extend f2c-gdb to work
- with other debuggers.
- -Do same with f2c - Clearly delineate what's f2c specific so that
- this can be used in general to support debugging languages not
- supported by a given debugger.
- -Improve installation procedure to make it more automatic. Get rid
- of this "edit the scripts and makefile" crap.
-
- See other files for additional To Do lists.
-
-